import java.math.BigInteger;

public class Fibonacci {

	//private static long cuentas = 0;

	/*public static long fibo_muy_larga(int n) {
		cuentas++;
		if (n < 2)
			return n;
		else
			return (fibo_muy_larga(n - 1) + fibo_muy_larga(n - 2));
	}*/

	public static String fiboserie(int n) {
		String serie = "0";
		BigInteger i = BigInteger.valueOf(1);
		BigInteger j = BigInteger.valueOf(0);
		BigInteger t = BigInteger.valueOf(0);
		for (int k = 1; k < n + 1; k++) {
			t = i.add(j);
			i = j;
			j = t;
			serie = serie + j + " ";
		}
		return serie;
	}
	
	
	public static BigInteger fibo(int n) {
		
		BigInteger i = BigInteger.valueOf(1);
		BigInteger j = BigInteger.valueOf(0);
		BigInteger t = BigInteger.valueOf(0);
		for (int k = 1; k < n + 1; k++) {
			t = i.add(j);
			i = j;
			j = t;
			
		}
		return j;
	}

	/*public static long fibo(int n) {
		if (n <= 0)
			return n;
		else {
			int i = n - 1;
			long a = 1;
			long antA = a;
			long b = 0;
			long c = 0;
			long antC = c;
			long d = 1;
			while (i > 0) {
				if (i % 2 != 0) {
					antA = a;
					a = d * b + c * a;
					b = d * (b + antA) + c * b;
				}
				antC = c;
				c = c * c + d * d;
				d = d * (2 * antC + d);
				i = i / 2;
			}
			return a + b;
		}
	}*/
	
	
	public static BigInteger sumaFibo(int n) {
		return (fibo(n + 2).subtract(BigInteger.valueOf(1)));
	}
	
	public static BigInteger sumaFibo2(int n) {
		BigInteger suma = BigInteger.valueOf(0);
		for (int i = 0; i < n + 1; i++) {
			suma = suma.add((fibo(i)).pow(2));
		}
		return suma;
	}

	/*public static void main(String[] args) {
		System.out.println(fibo(500));
		System.out.println(cuentas);
	}*/

}
